{extend name="admin/public/base"/}

{block name="body"}
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">{$meta_title}</h3>
		<div class="box-tools pull-right">
			<a class="btn btn-sm btn-success" href="{:url('/admin/model/add')}">新 增</a>
		</div>
	</div>
	<div class="box-body">
		<div class="table-responsive clearfix">
			<table class="table table-striped">
				<thead>
					<tr>
						<th class="row-selected row-selected">
							<input class="check-all" type="checkbox"/>
						</th>
						<th class="">编号</th>
						<th class="">标识</th>
						<th class="">名称</th>
						<th class="">创建时间</th>
						<th class="">状态</th>
						<th class="">操作</th>
					</tr>
				</thead>
				<tbody>
					{notempty name="list"}
					{volist name="list" id="item"}
					<tr>
						<td>
							<input class="ids" type="checkbox" name="id[]" value="{$item['id']}" />
						</td>
						<td>{$item['id']}</td>
						<td><i class="fa fa-{$item['icon']}"></i> {$item['name']}</td>
						<td>
							<a data-id="{$item.id}" href="{:url('/admin/model/edit', ['id'=>$item['id']])}">{$item['title']}</a>
						</td>
						<td>
							<span>{$item.create_time}</span>
						</td>
						<td>
							{if $item['status']}
							<span class="label label-primary">{$item['status_text']}</span>
							{else/}
							<span class="label label-danger">{$item['status_text']}</span>
							{/if}
						</td>
						<td>
							<a href="{:url('/admin/attribute/index', ['model_id'=>$item['id']])}">字段</a>
							<a href="{:url('/admin/model/status', ['id'=>$item['id'], 'status'=>abs(1-$item['status'])])}" class="ajax-get">{$item['status'] ? '禁用' : '启用'}</a>
							<a href="{:url('/admin/model/edit', ['id'=>$item['id']])}">编辑</a>
							<a href="{:url('/admin/model/del', ['id'=>$item['id']])}" class="confirm ajax-get">删除</a>
							{if $item['status']}
							<a href="{:url('/admin/'.$item['name'].'/index')}">数据</a>
							{else}
							<a href="javascript:alert('请先启用该模型');">数据</a>
							{/if}
						</td>
					</tr>
					{/volist}
					{else/}
					<td colspan="7" class="text-center">aOh! 暂时还没有创建模型!</td>
					{/notempty}
				</tbody>
			</table>

		</div>
		{$page|raw}
	</div>
</div>
{/block}